Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@heathmont/moon-themes
Advanced tools
--- name: Introduction menu: Themes route: /themes/introduction ---
Themes hold the design tokens for our individual brands and are an integral part of our UI.
Currently available themes include:
Wrap your entire application with the <ThemeProvider />
, providing your
preferred theme via the theme
prop.
Be sure to include Global styles, as these will inherit the theme and set the integral style foundations for your app.
/* App.tsx */
import React from 'react';
import { Global } from '@heathmont/moon-global';
import { ThemeProvider, sportsbetDark } from '@heathmont/moon-themes';
export const App = () => (
<ThemeProvider theme={sportsbetDark}>
<React.Fragment>
<Global />
<main>{/* Your App… */}</main>
</React.Fragment>
</ThemeProvider>
);
If you're using TypeScript, you can extend styled-components' types to include our theming schema.
To make use of extra features (such as auto-completion in VSCode), create a
d.ts
file with the following:
/* types/styled-components.d.ts */
import 'styled-components';
import { Theme } from '@heathmont/moon-themes';
declare module 'styled-components' {
export interface DefaultTheme extends Theme {}
}
The theme context is included by default in styled components props, and can be implemented as follows:
import styled from 'styled-components';
/* Access `theme` from styled component props */
const Example = styled.div(({ theme }) => ({
display: 'block',
color: theme.color.bulma[100],
padding: theme.space.default,
}));
/* Alternatively, destructure the theme properties… */
const Example = styled.div(({ theme: { color, space } }) => ({
display: 'block',
color: color.bulma[100],
padding: space.default,
}));
The useTheme
helper function returns the current theme from the theme context:
import React from 'react';
import { useTheme } from '@heathmont/moon-themes';
const Example = () => {
const theme = useTheme();
return <p>{theme.brand}</p>; /* Returns the theme brand name. */
};
or for more manual control:
import React from 'react';
import { ThemeContext } from '@heathmont/moon-themes';
const Example = () => {
const theme = React.useContext(ThemeContext);
return <p>{theme.brand}</p>; /* Returns the theme brand name. */
};
2.97.0 (2021-05-19)
FAQs
--- name: Introduction menu: Themes route: /themes/introduction ---
The npm package @heathmont/moon-themes receives a total of 0 weekly downloads. As such, @heathmont/moon-themes popularity was classified as not popular.
We found that @heathmont/moon-themes demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 134 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.